﻿<%@ 
Page Language="C#" 
MasterPageFile="~/sqlshare_master.Master"
AutoEventWireup="true" 
CodeBehind="default.aspx.cs" 
Inherits="WebQueryRole._Default"  
EnableViewState="false"
EnableEventValidation="false" %>
<%@ Register Assembly="Westwind.Web" Namespace="Westwind.Web.Controls" TagPrefix="ww" %>
<%@ Register assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" namespace="System.Web.UI.HtmlControls" tagprefix="cc1" %>

<asp:Content ContentPlaceHolderID="head" runat="server">
    <title>Azure Web Query Engine</title>   
</asp:Content>

<asp:Content ContentPlaceHolderID="main" runat="server">
<div class="sql_result" id="divErrors" runat="server" />   
    <!-- LEFT CONTENT -->
    <form id="serverForm" method="get" runat="server">
    <table style="width 100%; vertical-align:top; text-align: left">
        <tr>
            <td class="td_left">
            
                    <h3>Saved Queries</h3>
                    <asp:ListBox runat="server" 
                        class="querySelectList" 
                        id="querySelectList" 
                        onchange="clickLoadQuery()" 
                        style="width: 100%; height: 500px"></asp:ListBox>                
            
            </td>
            <td class="td_right">
            <!-- CENTER CONTENT -->
        
            
                <fieldset style="padding: 6px; ">
                <legend style="color: #383">Sql Editor</legend>
                    <div>
                        <h3>Saved Query 
                        <input type="button" class="button" disabled id="inputCopyToSql" value="copy to sql" onclick="clickCopyToSQL(false)" />
                        <input type="button" class="button" disabled value="execute saved query" id="inputAltQuery" onclick="clickCopyToSQL(true)" />
                        </h3>
                        <div id="sqlDiv" class="sql_text" runat="server" />
                    </div>
                    <div>
                        <h3>SQL</h3>
                        <textarea class="sql_text" style="width: 98%;" id="sqlTextBox" rows="9" name="mySQLTextbox" runat="server"></textarea>
                        <br />
                        
                        Limit the number of results returned:
                        <asp:DropDownList id="limitSelect" runat="server">
                        <asp:ListItem Text="10" Value="10" />
                        <asp:ListItem Text="100" Value="100" Selected="True" />
                        <asp:ListItem Text="1000" Value="1000" />
                        <asp:ListItem Text="10000" Value="10000" />
                        <asp:ListItem Text="unlimited" Value="0" />                
                        </asp:DropDownList>

                        <input class="button" type="submit" value="Query!" /> |
                        <input class="button" type="button" value="Download as tab delimited File" onclick="clickSaveToFile()" /> | 
                        <input class="button" type="button" value="Save as Table" onclick="clickSaveToView()" />
                    </div>
                    <div>
                        <h3>Title</h3>
                        <input class="desc_text" type="text" style="width: 50%" maxlength="50" runat="server" id="create_query_short_desc_input" onchange="typedShortDescModified()" />
                        Public <input type="checkbox" id="query_ispublic" /> | 
                        <input class="button" type="button" id="btnSaveQuery" value="save" onclick="clickSaveQuery()" /> | 
                        <input class="button" type="button" id="btnDeleteQuery" value="delete" onclick="clickDeleteQuery()" />
                    </div>
                    <div>
                        <h3>Description</h3>                
                        <textarea class="desc_text" style="width: 98%" rows="6" runat="server" id="create_query_long_desc_input"></textarea>
                    </div>
                </fieldset>
        
            </td>
        </tr>
    </table>
        
                                            
        
    </form>
    
    <!-- BOTTOM CONTENT (sql output, errors) -->
    <div class="content_bottom">
        <div class="sql_result" id="divSqlRowsFound" runat="server" />
        <asp:PlaceHolder ID="myPlaceHolder" runat="server" />            
    </div>
    
    
    <!-- INITIALIZE SCRIPTS // NOT PART OF GUI -->
    <ww:AjaxMethodCallback ID="Proxy" ServerUrl="AJAXCallbackHandler.aspx" runat="server" Timeout="4000" />
    <ww:ScriptContainer runat="server" ID="Scripts">
        <Scripts>            
            <script src="~/scripts/jquery.js" Resource="jquery"></script>
            <script src="~/scripts/ww.jQuery.js" Resource="ww.jquery"></script>
            <script src="scripts/default.js"></script>
            <script src="scripts/ajaxcallbacks.js"></script>                        
        </Scripts>
    </ww:ScriptContainer>
</asp:Content> 